Skip to content

feat: Support multiple active CAs in tctl auth export#51298

Merged
codingllama merged 5 commits intomasterfrom
codingllama/export-all-tctl
Jan 22, 2025
Merged

feat: Support multiple active CAs in tctl auth export#51298
codingllama merged 5 commits intomasterfrom
codingllama/export-all-tctl

Conversation

@codingllama
Copy link
Copy Markdown
Contributor

@codingllama codingllama commented Jan 21, 2025

Add multiple active CAs support to tctl auth export via the --out flag.

  • If a single active CA exists the behavior is the same as before
  • If multiple active CAs exist the error message is changed to refer to the --out flag
  • Any number of active CAs may be exported using --out without error

tctl before this PR:

$ tctl auth export --type=tls-user
ERROR: expected one TLS key pair, got 2

tctl after this PR:

$ tctl auth export --type=tls-user
ERROR: found 2 authorities to export, use --out to export all

$ tctl auth export --type=tls-user --out=ca
(stderr) Writing 2 files with prefix "ca"
(stdout) ca0.cer
(stdout) ca1.cer

$ cat ca?.cer
-----BEGIN CERTIFICATE-----
MIIDbTCCAlWgAwIBAgIRAIhXW7vBMC0zFynLPShxFH0wDQYJKoZIhvcNAQELBQAw
(...)
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDbDCCAlSgAwIBAgIQem9J7psCMl6QSKbClOdbtTANBgkqhkiG9w0BAQsFADBQ
(...)
-----END CERTIFICATE-----

Follow up from #51189.

#35444

Changelog: Added support for multiple active CAs in tctl auth export

@codingllama
Copy link
Copy Markdown
Contributor Author

Branched from #51189:

This also borrows inspiration from Gavin's #35754, although it has my own spin on it.

Comment thread tool/tctl/common/auth_command.go Outdated
Comment thread tool/tctl/common/auth_command.go Outdated
Copy link
Copy Markdown
Contributor

@GavinFrazar GavinFrazar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I left a couple of suggestions.

Thanks for fixing this!

Comment thread tool/tctl/common/auth_command.go Outdated
Comment thread tool/tctl/common/auth_command.go Outdated
@codingllama
Copy link
Copy Markdown
Contributor Author

Many thanks for the quick reviews! I'll queue once the base PR is in.

@codingllama
Copy link
Copy Markdown
Contributor Author

Friendly ping @avatus for g1 approval?

Base automatically changed from codingllama/export-all-funcs to master January 22, 2025 15:44
@codingllama codingllama force-pushed the codingllama/export-all-tctl branch from 3952448 to 492ba3d Compare January 22, 2025 16:44
@codingllama
Copy link
Copy Markdown
Contributor Author

Rebased on top of master, no changes. I'll prep some prereq backports then merge this one.

@codingllama codingllama enabled auto-merge January 22, 2025 19:19
@codingllama codingllama added this pull request to the merge queue Jan 22, 2025
Merged via the queue into master with commit 6181c0b Jan 22, 2025
@codingllama codingllama deleted the codingllama/export-all-tctl branch January 22, 2025 19:52
@public-teleport-github-review-bot
Copy link
Copy Markdown

@codingllama See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Create PR

codingllama added a commit that referenced this pull request Jan 22, 2025
* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
codingllama added a commit that referenced this pull request Jan 22, 2025
* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
github-merge-queue Bot pushed a commit that referenced this pull request Jan 22, 2025
)

* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
github-merge-queue Bot pushed a commit that referenced this pull request Jan 22, 2025
)

* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
carloscastrojumo pushed a commit to carloscastrojumo/teleport that referenced this pull request Feb 19, 2025
…l#51298)

* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v17 size/sm tctl tctl - Teleport admin tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants